package com.online_video.dao.impl;

import com.online_video.dao.BaseDao;
import com.online_video.dao.CommentDao;
import com.online_video.entity.Comment;

import java.util.Date;
import java.util.List;


/**
 * Created with IntelliJ IDEA.
 *
 * @Author: 黄金星
 * @Date: 2022/03/21/下午2:40
 * @Description:
 */
public class CommentDaoImpl extends BaseDao implements CommentDao {
    @Override
    public int insert(Comment comment) {
        String sql = "INSERT INTO `T_comment`(`vid`,`u_id`,`comment`,`date`) values(?,?,?,?)";
        return super.update(sql,comment.getVid(),comment.getU_id(),comment.getComment(),new Date());
    }

    @Override
    public int update(Comment comment) {
        return 0;
    }

    @Override
    public int delete(Integer id) {
        return 0;
    }

    @Override
    public List<Comment> queryByVid(Integer vId) {
        String sql = "SELECT * FROM `T_comment` WHERE `vid` = ?";
        return super.queryForList(Comment.class,sql,vId);
    }
}
